#ifndef MYWIDGET_H
#define MYWIDGET_H

#include <QWidget>



//前置声明
//From QtWidgets
class QLabel;
class QSlider;
class QComboBox;
class QTableView;
class QPushButton;
class QGridLayout;
class QDoubleSpinBox;
//From QCustomPlot
class QCustomPlot;
class QCPGraph;
//自己写的
class SplineFitter;
class OLSFitter;
class AbstractFitter;
class MyTableModel;





class MyWidget : public QWidget
{
    Q_OBJECT


public:
    explicit MyWidget(QWidget *parent = nullptr);
    virtual MyTableModel* model();
public slots:
    void setFitPointsCount(size_t n);
    //改变拟合点数后计算这些点的值
    virtual void setParamater();
    virtual QPointF fitRange();
    virtual void refit();
    //全部重新算
    void reset();
protected:
    //以下四个函数仅用作初始化，不得在构造函数外随意调用
    virtual void initControlPanel();
    virtual void initPlotCanvas(int i);
    virtual void initTableView();
    virtual void connectSingals();
protected:
    QGridLayout * m_layoutControl;
    QSlider * m_slider;
    QLabel * m_labPointsCount;
    QLabel * m_labPerimeter;
    QLabel * m_labEval;
    QComboBox * m_comboDoundary;
    QPushButton * m_btnOpen;
    QPushButton * m_btnSaveFigure;
    QDoubleSpinBox * m_spinLeft;
    QDoubleSpinBox * m_spinRight;
    QDoubleSpinBox * m_spinEval;
protected:
    QCustomPlot * m_plot;
    QCPGraph *m_scatter;
    QCPGraph *m_curve;
protected:
    QTableView * m_tableView;
    MyTableModel *m_model1;
protected:
    size_t m_fitPointsCount;
    AbstractFitter* m_abstractFitter;



};
#endif // MYWIDGET_H
